<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/8/9
  Time: 18:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<title></title>
<base href="/ks_manager/">
<style>
    body{
        font-size:16px;
    }
    p{
        margin: 0;
    }
</style>
<body>

<div align="center">
    <input type="button" name="print" value="打印" id="butprint">
</div>
</body>
<script type="text/javascript" src="static/js/base.min.js?_v=190102162154"></script>
<script type="text/javascript">
    requireJS(['constant', 'site', 'handlebars', 'public'], function (Constant, site, Handlebars, Public) {

        var list = <%=request.getParameter("list")%>
        var title = <%=request.getParameter("title")%>
        document.title = title;
        list = '<!--startprint-->' + list + '<!--endprint-->'
        $("body div").after(list);
        /*var source = $("#taxDetail_list_tpl").html();
        var template = Handlebars.compile(source);
        var html = template(list)
        $('#taxDetail_list').html(html)*/

        function preview() {
            bdhtml = window.document.body.innerHTML;
            sprnstr = "<!--startprint-->";
            eprnstr = "<!--endprint-->";
            prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
            prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
            //console.log(prnhtml)
            window.document.body.innerHTML = prnhtml;
            console.log(window.document.body.innerHTML)
            window.print();
            window.document.body.innerHTML = bdhtml;
            window.location.reload();
        }

        $("#butprint").on('click',function(){
            preview();
        })
    })
</script>
